package org.ccay.validator.validators;

import com.opensymphony.xwork2.validator.validators.RegexFieldValidator;


/**
 * <!-- START SNIPPET: javadoc -->
 * NumericValidator checks that a given String field, if not empty,
 * is a valid numeric.
 * <p/>
 * <p/>
 * The regular expression used to validate that the string is an numeric
 * is:
 * </p>
 * <pre>
 * ([0-9])*
 * </pre>
 * <!-- END SNIPPET: javadoc -->
 * 
 * 
 * <!-- START SNIPPET: parameters -->
 * <ul>
 * 		<li>fieldName - The field name this validator is validating. Required if using Plain-Validator Syntax otherwise not required</li>
 * </ul>
 * <!-- END SNIPPET: parameters -->
 * 
 * 
 * <pre>
 * <!-- START SNIPPET: example -->
 *     &lt;!-- Plain Validator Syntax --&gt;
 *     &lt;validators&gt;
 *         &lt;validator type="numeric"&gt;
 *             &lt;param name="fieldName"&gt;myNumeric&lt;/param&gt;
 *             &lt;message&gt;Must provide a valid numeric&lt;/message&gt;
 *         &lt;/validator&gt;
 *     &lt;/validators&gt;
 *     
 *     &lt;!-- Field Validator Syntax --&gt;
 *     &lt;field name="myNumeric"&gt;
 *        &lt;field-validator type="numeric"&gt;
 *           &lt;message&gt;Must provide a valid numeric&lt;/message&gt;
 *        &lt;/field-validator&gt;
 *     &lt;/field&gt;
 * <!-- END SNIPPET: example -->
 * </pre>
 *
 * @author chaowangbang
 * @author chaowangbang
 * @version $Date: 2008-12-16 00:02:09 +0800 (Tue, 16 Dec 2008) $ $Id: EmailValidator.java 1885 2008-12-15 16:02:09Z musachy $
 */
public class NumericValidator extends RegexFieldValidator {

	// see XW-371 
    public static final String NUMERIC_PATTERN = "([0-9])*";

    public NumericValidator() {
        setExpression(NUMERIC_PATTERN);
        setCaseSensitive(false);
    }

}